c1e1d254cb1a411b84610467a69e1f7992635a54
[git-annex.git] /
1 [[!comment format=mdwn
2  username="joey"
3  subject="""comment 1"""
4  date="2022-10-26T16:44:21Z"
5  content="""
6 Windows is not needed, this will happen in a 
7 repository where `git annex adjust --unlock` has been run.
8
9 A simpler example:
10
11         joey@darkstar:~/tmp/t2#master(unlocked)>git-annex addurl --batch
12         http://google.com/
13         addurl http://google.com/
14         (to google.com_) ok
15         ^Z
16         joey@darkstar:~/tmp/t2#master(unlocked)>git-annex metadata --batch --json
17         {"file":"google.com_","fields":{"author":["bar"]}}
18
19 I'm not sure if this is a bug, because it's documented to output a blank
20 line when batch mode is provided a file that is not an annexed file, and
21 the file is not an annexed file yet due to the pointer not yet having been
22 staged in git. Which is needed, when in an adjusted unlocked branch, for
23 git-annex to know that this is an annexed file.
24
25 When the file is locked, it just stats the symlink, so the fact that the
26 symlink is not yet staged in git doesn't matter.
27
28 It does not seem to make sense to have addurl update the index
29 after each file it adds, because that would make addurl of a lot
30 of files unncessarily slow.
31
32 So, I think if anything is changed, it would need to be a change to make
33 the behavior with unlocked files consistent with the behavior with locked
34 files. Eg, when the symlink is not yet staged in git, treat it as a
35 non-annexed file. Which is also consistent with other handling of such
36 files by git-annex when not in batch mode.
37
38 The solution for your program, though, seems like it will be to end the
39 git-annex addurl process before trying to set metadata on just-added files.
40 Or, alternatively, to use addurl with --json, extract the key, and set the
41 metadata of the key.
42 """]]